package com.dp.selenium.grid.demo.testobj;

import java.util.concurrent.Callable;

import org.openqa.selenium.By;

import com.dp.selenium.grid.demo.common.NodeServerInfo;
import com.dp.selenium.grid.demo.common.RstMsg;
import com.dp.selenium.grid.demo.test.DoTest;

public class DoGoogleTest extends DoTest implements Callable<RstMsg> {

	private static String urlBaidu = "http://www.google.com";

	public DoGoogleTest(String firefoxLocation, String nodeServerURL) {
		super(firefoxLocation, nodeServerURL, urlBaidu);
	}

	public DoGoogleTest(NodeServerInfo node) {
		super(node.getFirefoxLocaltion(), node.getHostAddress(), urlBaidu);
	}

	public RstMsg test() {

		try {
			getDriver().findElement(By.id("kw")).sendKeys("Selenium");
			getDriver().findElement(By.id("su")).click();
		} catch (Exception e) {
			return RstMsg.getFaild(e.getMessage());
		}
		return RstMsg.getSucess();
	}

}
